package cn.itcast.bookmanager.jframe;

import cn.itcast.bookmanager.dao.UserDao;
import cn.itcast.bookmanager.model.User;
import cn.itcast.bookmanager.util.JdbcUtils;
import cn.itcast.bookmanager.util.ToolUtils;
import com.mysql.jdbc.Connection;
import org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LanguageFrame extends JFrame {
	public static User currentUser;
	private JFrame jf;
	private JTextField userNameText;
	private JTextField passwordText;
	private JComboBox<String> comboBox;
	
	UserDao userDao = new UserDao();
	JdbcUtils dbUtil = new JdbcUtils();
	public LanguageFrame(){
				
		jf=new JFrame("图书管理");
		jf.getContentPane().setFont(new Font("幼圆", Font.BOLD, 14));
		jf.setBounds(600, 250, 500, 467);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		jf.getContentPane().setLayout(null);

		JLabel lblNewLabel = new JLabel(new ImageIcon(LanguageFrame.class.getResource("/tupian/bg2.png")));
		lblNewLabel.setBounds(24, 10, 430, 218);
		jf.getContentPane().add(lblNewLabel);

		JLabel label = new JLabel("请选择您的语言");
		label.setFont(new Font("幼圆", Font.BOLD, 17));
		label.setBounds(150, 250, 200, 30);
		jf.getContentPane().add(label);

		JLabel label2 = new JLabel("Please select your language");
		label2.setFont(new Font("幼圆", Font.BOLD, 17));
		label2.setBounds(150, 300, 300, 29);
		jf.getContentPane().add(label2);


		JButton button = new JButton("中文");
		button.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				goCh(e);
			}
		});
		button.setBounds(153, 350, 65, 29);
		jf.getContentPane().add(button);
		
		JButton button_1 = new JButton("English");
		button_1.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				goEn(e);
			}
		});
		button_1.setBounds(263, 350, 65, 29);
		jf.getContentPane().add(button_1);
		
		JLabel lblNewLabel_1 = new JLabel("");
		lblNewLabel_1.setIcon(new ImageIcon(LanguageFrame.class.getResource("/tupian/adBG3.png")));
		lblNewLabel_1.setBounds(0, 0, 484, 429);
		jf.getContentPane().add(lblNewLabel_1);
		
		jf.setVisible(true);
		jf.setResizable(true);
		
	}

	private void goEn(ActionEvent e) {
		jf.dispose();
		new LoginFrameEn();
	}

	private void goCh(ActionEvent e) {
		jf.dispose();
		new LoginFrame();
	}

	protected void regUser(ActionEvent e) {
		jf.setVisible(false);
		new RegFrame();
		
	}

	public static void main(String[] args) {
		try {
			BeautyEyeLNFHelper.frameBorderStyle = BeautyEyeLNFHelper.FrameBorderStyle.generalNoTranslucencyShadow;
			BeautyEyeLNFHelper.launchBeautyEyeLNF();
		} catch (Exception e) {
			e.printStackTrace();
		}
		new LanguageFrame();
	}
}
